<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script src="spellcheck_test.js"></script>

<script>
spellcheck_test(
    '<div contenteditable>|</div>',
    'insertText This sentence ends with a misspelled word asd. ',
    '<div contenteditable>This sentence ends with a misspelled word #asd#.\u00A0</div>',
    {
      title: 'Mark misspelled word "asd" after typing.',
      callback: sample => spellcheck_test(
          sample,
          () => {
            const selection = sample.selection;
            selection.modify('move', 'backward', 'character');
            selection.modify('move', 'backward', 'character');
            selection.modify('move', 'backward', 'character');
            selection.modify('move', 'backward', 'character');
            selection.modify('move', 'backward', 'character');
          },
          '<div contenteditable>This sentence ends with a misspelled word #asd#.\u00A0</div>',
          'Misspelled word should still be marked when caret is no longer adjacent with it.')
    });
</script>
